﻿using System;
using System.Windows.Forms;

namespace DSClient
{
    public partial class frmClient : Form
    {
        private void HandleMessage(string msg)
        {
            string[] tokens = msg.Trim().Split(' ');
            string minusFirst = msg.Substring(tokens[0].Length + 1);

            switch (tokens[0])
            {
                case "{CONNECT_OK}":
                    username = tokens[1];
                    Connected();
                    break;

                case "{CONNECT_FAIL}":
                    OutputWriteLine("Connection failed: " + minusFirst);
                    break;

                case "{CLIENTS}":
                    OutputWriteLine("Connected clients: " + minusFirst);
                    break;

                case "{MESSAGE}":
                    OutputWriteLine(minusFirst);
                    break;
            }
        }
    }
}
